package src.itheima03;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class A {
    public static void main(String[] args) {
        //创建HashMap集合对象,键: Student 值: String 地址,名字和年龄
        Map<B,String>map=new HashMap();
        //3.HashMap集合对象调用put方法,添加多个键值对
        map.put(new B(10,"haha"),"223");
        map.put(new B(20,"ww"),"2");
        map.put(new B(30,"dd"),"3");
        map.put(new B(40,"uu"),"4");
        map.put(new B(50,"ii"),"5");
        //4.HashMap集合对象调用keySet方法,获取所有的键放入的Set集合
        Set<B> set=map.keySet();
        //5.遍历所有的键对应的Set集合: 增强for
        for (B b : set) {
            System.out.println(map.get(b));
        }
        //获取键值，再通过键获取值



    }
}
